import store from '@/store'

export function actionToObject(json) {
  try {
    return JSON.parse(json)
  } catch (e) {
    console.log('err', e.message)
  }
  return []
}

export function hasBtnPermission(permission) {
  const myBtns = store.getters.buttons
  const adminType = store.getters.adminType
  if (adminType === '1') {
    return true
  }
  return myBtns.indexOf(permission) > -1
}
